const {
  mrjAsyncBaseReq, //  基本请求
  BaseRequestModel, // 基本请求对象
} = require('./mrhhttp')

const api_merchant_device_list = "/core/merchant/ordered/device/list"
const api_merchant_device_info = "/device/info"
const api_merchant_device_last_image = "/device/param/base/setting/image"
const api_merchant_device_reboot = "/device/reboot"
const api_merchant_device_alias_edit = "/device/alias"
const api_merchant_device_net_delete = "/device/netdel"
const api_merchant_device_config_param_info = "/device/params"
const api_merchant_device_net_config_save = "/device/param/network/setting"
const api_merchant_device_net_config_info = "/device/param/network"
const api_merchant_device_delete = "/core/merchant/ordered/device/removeByDeviceId"//删除设备
const api_merchant_device_add = "/core/merchant/ordered/device/add"
const api_merchant_device_config_param_save = "/device/params/save"
const api_merchant_device_grap_pic_cmd = "/device/grap"
const api_merchant_device_param_height_save = "/device/param/setting/height"


const api_merchant_device_choose = "/core/merchant/shop/device/choose"


const DeviceHttp = {
  loadListForChoice: async (param) => {
    const res = await mrjAsyncBaseReq({
      ...BaseRequestModel,
      url: `${BaseRequestModel.baseUrl}${api_merchant_device_choose}`,
      param: param
    });
    return res.data
  },

  loadList: async (param) => {
    const res = await mrjAsyncBaseReq({
      ...BaseRequestModel,
      url: `${BaseRequestModel.baseUrl}${api_merchant_device_list}`,
      param: param
    });
    return res.data
  },
  loadDetail:async(param)=>{
    const res = await mrjAsyncBaseReq({
      ...BaseRequestModel,
      url: `${BaseRequestModel.baseUrl}${api_merchant_device_info}`,
      param: param
    });
    return res.data
  },
  getNewImg:async(param)=>{
    const res = await mrjAsyncBaseReq({
      ...BaseRequestModel,
      url: `${BaseRequestModel.baseUrl}${api_merchant_device_last_image}`,
      param: param
    });
    return res.data
  },
  grapPic:async(param)=>{
    const res = await mrjAsyncBaseReq({
      ...BaseRequestModel,
      url: `${BaseRequestModel.baseUrl}${api_merchant_device_grap_pic_cmd}`,
      param: param
    });
    return res.data
  },
  netConfig:async(param)=>{
    const res = await mrjAsyncBaseReq({
      ...BaseRequestModel,
      url: `${BaseRequestModel.baseUrl}${api_merchant_device_net_config_info}`,
      param: param
    });
    return res.data
  },
  
  getDrawParam:async(param)=>{
    const res = await mrjAsyncBaseReq({
      ...BaseRequestModel,
      url: `${BaseRequestModel.baseUrl}${api_merchant_device_config_param_info}`,
      param: param
    });
    return res.data
  },
  saveDrawParam:async(param)=>{
    const res = await mrjAsyncBaseReq({
      ...BaseRequestModel,
      url: `${BaseRequestModel.baseUrl}${api_merchant_device_config_param_save}`,
      param: param
    });
    return res.data
  },
  saveDeviceHeight:async(param)=>{
    const res = await mrjAsyncBaseReq({
      ...BaseRequestModel,
      url: `${BaseRequestModel.baseUrl}${api_merchant_device_param_height_save}`,
      param: param
    });
    return res.data
  },
  
  setNet:async(param)=>{
    const res = await mrjAsyncBaseReq({
      ...BaseRequestModel,
      url: `${BaseRequestModel.baseUrl}${api_merchant_device_net_config_save}`,
      param: param
    });
    return res.data
  },
  editAlias:async(param)=>{
    const res = await mrjAsyncBaseReq({
      ...BaseRequestModel,
      url: `${BaseRequestModel.baseUrl}${api_merchant_device_alias_edit}`,
      param: param
    });
    return res.data
  },
  delNet:async(param)=>{
    const res = await mrjAsyncBaseReq({
      ...BaseRequestModel,
      url: `${BaseRequestModel.baseUrl}${api_merchant_device_net_delete}`,
      param: param
    });
    return res.data
  },


  
  deviceReboot:async(param)=>{
    const res = await mrjAsyncBaseReq({
      ...BaseRequestModel,
      url: `${BaseRequestModel.baseUrl}${api_merchant_device_reboot}`,
      param: param
    });
    return res.data
  },
  
  actionDelete:async(param)=>{
    const res = await mrjAsyncBaseReq({
      ...BaseRequestModel,
      url: `${BaseRequestModel.baseUrl}${api_merchant_device_delete}`,
      param: param
    });
    return res.data
  },
  actionAdd:async(param)=>{
    const res = await mrjAsyncBaseReq({
      ...BaseRequestModel,
      url: `${BaseRequestModel.baseUrl}${api_merchant_device_add}`,
      param: param
    });
    return res.data
  },
  
}
module.exports = DeviceHttp;